import request from '@/config/axios'

export interface OutboundTaskOrderVO {
  id: number
  requisitionForm: string
  dictOutsourceMode: number
  productNumber: string
  partNumber: string
  partName: string
  drawingNumber: string
  partSpecification: string
  material: string
  specification: string
  netSizeLength: number
  netSizeWidth: number
  cuttingSizeLength: number
  cuttingSizeWidth: number
  planQuantity: number
  partUnit: string
  dictProcessName: number
  dictTypeOfWork: number
  dictBaitingType: number
  dictIsMachine: number
  dictMachiningProcess: number
  creatorName: string
  updaterName: string
  requirementTime: Date
}

// 查询外协管理 -- 外协订单 -- 外协任务单列表
export const getOutboundTaskOrderPage = async (params) => {
  return await request.get({ url: `/outsource/outbound-task-order/page`, params })
}

// 查询外协管理 -- 外协订单 -- 引用外协任务单列表
export const getOutboundTaskOrderFindAll = async (params) => {
  return await request.get({ url: `/outsource/outbound-task-order/findAll`, params })
}

// 查询外协管理 -- 外协订单 -- 供应商列表
export const getOutboundTaskOrderSrmList = async (params) => {
  return await request.get({ url: `/config/srm-supplier/list`, params })
}

// 查询外协管理 -- 外协订单 -- 供应商列表
export const getOutboundTaskOrderSrmInvoice = async (id) => {
  return await request.get({ url: `/config/srm-supplier/invoice?deptId=` + id })
}

// 查询外协管理 -- 外协订单 -- 外协任务单详情
export const getOutboundTaskOrder = async (id: number) => {
  return await request.get({ url: `/outsource/outbound-task-order/get?id=` + id })
}

// 查询外协管理 -- 外协订单 -- 外协任务单详情
export const getOutboundTaskOrderList = async (id: number[]) => {
  return await request.get({ url: `/outsource/outbound-task-order/list?ids=` + id })
}

// 保存外协管理 -- 外协订单 -- 外协任务单
export const createOutboundTaskOrder = async (data) => {
  return await request.post({ url: `/outsource/outbound-order-form/create`, data })
}

// 提交外协管理 -- 外协订单 -- 外协任务单
export const submitOutboundTaskOrder = async (data) => {
  return await request.post({ url: `/outsource/outbound-order-form/submit`, data })
}

// 删除外协管理 -- 外协订单 -- 外协任务单
export const deleteOutboundTaskOrder = async (id: number) => {
  return await request.delete({ url: `/outsource/outbound-task-order/delete?id=` + id })
}

// 导出外协管理 -- 外协订单 -- 外协任务单 Excel
export const exportOutboundTaskOrder = async (params) => {
  return await request.download({ url: `/outsource/outbound-task-order/export-excel`, params })
}
